package com.etalk.crm.controller.textbook;

import com.alibaba.fastjson.JSON;
import com.etalk.crm.service.TextbooksService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

/**
 * @author Jordan
 */
@Controller
@RequestMapping(value = "/textbook")
public class TextbookController {

    @Resource
    private TextbooksService textbooksService;

    /**
     * 获取教材页码列表
     * @param id 教材id
     * @return
     */
    @ResponseBody
    @PostMapping("/page/list/{id}")
    public String getTextbookCfg(@PathVariable("id") Integer id){
        return JSON.toJSONString(textbooksService.searchTextbookAddressById(id));
    }
}
